<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <textarea name="" id="aa" cols="30" rows="10"></textarea>
    <input type="text" name="" id="passs">
    <button>点击</button>
    <img id="imm" src="" alt="">
</body>
<script>
    let a = document.getElementById("aa");
    let btn = document.querySelector("button");
    //点击按钮发起Ajax请求,并将textarea中的内容作为参数传递btn.onclick = function(){
    btn.onclick = function () {
        let xhr = new XMLHttpRequest();
        xhr.open("get", "http://localhost:3000/api/logingo?account=" + a.value + '&' + 'password=' + passs.value);
        xhr.send();
        xhr.onload = function () {
            console.log(JSON.parse(xhr.responseText));
        }
    }

</script>

</html>